package com.itheima.demo1;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class TestDemo1 {
    public static void main(String[] args) {

        ArrayList<String> list = new ArrayList<>();
        ArrayList<String> list2 = new ArrayList<>();

        Collections.addAll(list,"张三","李四","王五","赵六","阿伟","范闲");

        int size = list.size();
        Random r = new Random();
        for (int i = 1 ; i <= 5 ; i++) {
            System.out.println("===========第"+i+"轮================");
            for (int j = 0; j < size ; j++) {
                int index = r.nextInt(list.size());
                String remove = list.remove(index);
                list2.add(remove);
                System.out.println(remove);
            }
            list.addAll(list2);
            list2.clear();
        }

    }
}
